package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.cabinetKeyPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

@Mapper
public interface cabinetKeyMapp {

    @DS("newMscLowCodeTest")
    @Insert("INSERT INTO ddm_cabinet_key (" +
            "id, create_time, update_time, creator, process_status, sys_update_user, " +
            "sys_audit_user, sys_audit_time, sys_deleted, keyNumber, keyGender, cabinetNumber, " +
            "cabinetGender, Location" +
            ") VALUES (" +
            "#{id}, #{create_time}, #{update_time}, #{creator}, #{process_status}, #{sys_update_user}, " +
            "#{sys_audit_user}, #{sys_audit_time}, #{sys_deleted}, #{keyNumber}, #{keyGender}, #{cabinetNumber}, " +
            "#{cabinetGender}, #{Location}" +
            ")")
    void insertOne(cabinetKeyPojo cabinetKeyPojo);

    @DS("newMscLowCodeTest")
    @Select("SELECT * FROM ddm_cabinet_key WHERE sys_deleted = 0")
    List<cabinetKeyPojo> queryAll();

    @DS("newMscLowCodeTest")
    @Update("UPDATE ddm_cabinet_key SET " +
            "update_time = #{update_time}, " +
            "creator = #{creator}, " +
            "process_status = #{process_status}, " +
            "sys_update_user = #{sys_update_user}, " +
            "sys_audit_user = #{sys_audit_user}, " +
            "sys_audit_time = #{sys_audit_time}, " +
            "keyNumber = #{keyNumber}, " +
            "keyGender = #{keyGender}, " +
            "cabinetNumber = #{cabinetNumber}, " +
            "cabinetGender = #{cabinetGender}, " +
            "Location = #{Location} " +
            "WHERE id = #{id} AND sys_deleted = 0")
    void updateCabinetKey(cabinetKeyPojo cabinetKeyPojo);


}
